package com.lagou.edu.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lagou.edu.pojo.Resume;
import com.lagou.edu.service.impl.ResumeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rpq
 * @since 2021-07-13
 */
@RestController
@RequestMapping("/resume")
public class ResumeController {

        @Value("${server.port}")
        String port;

        @Autowired
        ResumeServiceImpl resumeService;

        /**
         * @Description 根据用户id查询简历开放状态
         * @Param [userId] 用户id
         * @return java.lang.Integer （开放状态 0-关闭，1-打开，2-简历未达到投放标准被动关闭 3-从未设置过开放简历）
         */
        @RequestMapping("/openstate")
        public String findDefaultResumeStata(){

            return "8081";
        }

        @RequestMapping("/state/{userId}")
        public Integer check(@PathVariable Long userId){
                QueryWrapper<Resume> queryWrapper = new QueryWrapper();
                queryWrapper.eq("id",userId);
                Integer isopenresume = resumeService.getOne(queryWrapper).getIsopenresume();
                return isopenresume;
        }

}

